#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2021-11-5 16:53
import openpyxl


def get_excel_data():
    """
    获取excel中的值
    :return:
    """
    # 获取工作簿
    book = openpyxl.open('./demo_pytest/data/params.xlsx')

    # 读取活跃的工作表
    sheet = book.active

    # 获取连续的多个单元格
    cells = sheet['A1':'C3']

    values = []
    # 遍历单元格，并获取值
    for row in cells:
        cell_data = []
        for cell in row:
            cell_data.append(cell.value)
        values.append(cell_data)
    return values

    # 获取单个单元格
    # cell_a1 = sheet.cell(column=1, row=1)
    # cell_a2 = sheet['B2']

    # 获取单元格的值
    # print(f'cell_a1:{cell_a1}')
    # print(f'cell_a2:{cell_a2}')
    # print(f'cells:{cells}')

    # print(f'cell_a1的值是：{cell_a1.value}')
    # print(f'cell_a2的值是：{cell_a2.value}')
    # print(f'cells的值是：{cells.value}')
